package com.usian;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {

    public static void main(String[] args) {

        ApplicationContext context =
                new ClassPathXmlApplicationContext("applicationContext-rabbitmq-producer.xml");
        RabbitTemplate rabbitTemplate = (RabbitTemplate)context.getBean("rabbitTemplate");
        //rabbitTemplate.convertAndSend("","queue.test","消息测试1");
        rabbitTemplate.convertAndSend("exchange.fanout_test","","分裂消息测试1");
        ((ClassPathXmlApplicationContext) context).close();
    }
}
